﻿using System.Linq;
using NUnit.Framework;

namespace StreetPacMan.Server.Tests.Integ
{
    [TestFixture]
    public class GameStarted : BddBase
    {
        private readonly Game GameInstance;
        private readonly IServerFacade ServerFacade;

        public GameStarted()
        {
            ServerFacade = ServerFacadeFactory.GetServerFacade();
            GameInstance = ServerFacade.CreateGame("GameName");
        }

        [Test]
        public void GameStateShouldBeCreated()
        {
            Assert.AreEqual(GameState.Created, GameInstance.GameStateEnum);
        }

        [Test]
        public void OnObserverPlayerShouldExist()
        {
            Assert.AreEqual(PlayerRole.Observer, GameInstance.Players.Single().RoleEnum);
        }

        [Test]
        public void OneEventOfGameCreatedShouldExists()
        {
            Assert.AreEqual(GameEventType.GameCreated, ServerFacade.GetAllGameEvents(GameInstance.Id).Single().EventTypeEnum);
        }
    }
}